package com.example.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.domain.Dish;
import com.example.domain.Setmeal;
import jakarta.servlet.http.PushBuilder;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Set;

@Mapper
public interface SetmealDao extends BaseMapper<Setmeal> {
    @Select("select count(*) from setmeal where category_id=#{id}")
    public int selectByCategoryIdInt(Long id);

    @Select("select * from setmeal limit #{pageCount},#{pageSize}")
    public List<Setmeal> selectall(int pageCount,int pageSize);

    @Select("select count(*) from setmeal")
    public int selectcount();

    @Select("select * from setmeal where name=#{name} limit #{pageCount},#{pageSize}")
    public List<Setmeal> selectbyname(int pageCount,int pageSize,String name);

    @Insert("insert into setmeal values (#{id},#{categoryId},#{name},#{price},#{status},#{code},#{description},#{image},#{createTime},#{updateTime},#{createUser},#{updateUser},#{isDeleted})")
    public void savesetmeal(Setmeal setmeal);
    @Select("select status from setmeal where id=#{id}")
    public int getstatusbyid(Long id);

    @Delete("delete from setmeal where id=#{id}")
    public void deletebyid(Long id);

    @Select("select name from setmeal where id=#{id}")
    public String getnamebyid(Long id);

    @Update("update setmeal set status=#{status},update_time=#{updateTime},update_user=#{updateUser} where id=#{id}")
    public void updatestatusbyid(Setmeal setmeal);

    @Select("select * from setmeal where category_id=#{categoryId} and status=#{status}")
    public List<Setmeal> selectByCategoryIdandstatus(Setmeal setmeal);
}
